/*
Minims .Net Playstation 3 UPNP ContentDirectory
Copyright (C) 2008  Guillaume Plourde

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace minims
{
	static class Program
	{
		static void Main(string[] args)
		{
			Hashtable services;
			SSDP_SERVER ssdp_server;
			HTTP_SERVER http_server;
			FileManager file_manager;

			file_manager = new FileManager();
			// Add System files to FileManager
			file_manager.Add(new MinimsFile(FILETYPE.System, "/System/Root.xml", RootDevice.GetRootDeviceXml()));
			file_manager.Add(new MinimsFile(FILETYPE.System, "/System/ContentDirectory.xml", ContentDirectory.GetDescription()));

			services = new Hashtable();
			http_server = new HTTP_SERVER(services, file_manager, ConfigManager.GetPort);
			
			ssdp_server = new SSDP_SERVER();
			List<string> folders = new List<string>();

			foreach (string f in args)
			{
				folders.Add(f);
			}
			services.Add("ContentDirectory", new ContentDirectory(folders));

			ssdp_server.Start();
			http_server.Start();
		}
	}
}